function Ninja() {
    let _skillLevel = 0;
    Object.defineProperty(this, 'skillLevel', {
        get: ()=>_skillLevel,
        set: value=>{
            if(!Number.isInteger(value)){
                throw new TypeError("skill level should be a number");
            }
            _skillLevel = value;
        }
    })
}

const ninja = new Ninja()
ninja.skillLevel = 10;

try {
    ninja.skillLevel = 'Great';
}catch (e) {
    console.log(e)
}